vr2-5-12.wrl


[ VRML source code ]

#VRML V2.0 utf8
#vr2-5-12.wrl
#Viewpoint { position 0 -50 150 }
#Golfer
Group {
  children [
    #body
    Transform {
      translation 15 -10 -5 
      scale 1 2 1
      children Shape {
        appearance Appearance {
          material Material {
            diffuseColor 1 1 0
          }
        }
        geometry Sphere { radius 10 }
      }
    }
    Transform {
      translation 13 -6 5 
      scale 1 2 1
      children DEF Eye Shape {
        appearance Appearance {
          material Material {
            diffuseColor 0.2 0.2 0.2
          }
        }
        geometry Sphere {}
      }
    }
    Transform {
      translation 17 -6 5 
      scale 1 2 1
      children USE Eye
    }
    Transform {
      translation 15 -25 -5 
      scale 1 2 1
      children Shape {
        appearance Appearance {
          material Material {
            diffuseColor 0 1 1
          }
        }
        geometry Cone {
          bottomRadius 15
          height 40
        }
      }
    }
  ]
}
Group {
  children [
    DEF Golf TouchSensor {}
    #Virtual Golf Wood
    #grip
    Group {
      children [
        Transform {
          rotation 1 0 0 3.141592
          children Shape {
            appearance Appearance {
              material Material {
                diffuseColor 0.3 0.6 0.3
              }
            }
            geometry Cone {
              bottomRadius 3
              height 30
            }
          }
        }
        #shaft
        Transform {
          translation 0 -42.5 0
          rotation 1 0 0 3.141592
          children Shape {
            appearance Appearance {
              material Material {
                diffuseColor 0.8 0.8 0.8
              }
            }
            geometry Cone {
              bottomRadius 0.8
              height 70
            }
          }
        }
        Transform {
          translation 0 -55 0
          rotation 1 0 0 3.141592
          children Shape {
            appearance Appearance {
              material Material {
                diffuseColor 0.8 0.8 0.8
              }
            }
            geometry Cylinder {
              radius 0.5
              height 30
            }
          }
        }
        #wood
        Transform {
          translation -7 -76 0
          scale 2 1 1
          rotation 0 0 1 0.5
          children Shape {
            appearance Appearance {
              material Material {
                diffuseColor 0.87 0.72 0.52
              }
            }
            geometry Sphere { radius 6 }
          }
        }
      ]
    }
  ]
}

DEF Ball Transform {
  translation -5 -75 10
  children Shape {
    geometry Sphere { radius 5 }
  }
}
DEF Timer TimeSensor {
  cycleInterval 2
  startTime 0
}
DEF MoveBall PositionInterpolator {
  key [ 0, 1 ]
  keyValue [ -5 -75 10, -5 -75 70 ]
}

#Green
Transform {
  translation -5 -82 10
  children Shape {
    appearance Appearance {
      material Material {
        diffuseColor 0 1 0
      }
    }
    geometry Cylinder { 
      radius 100
      height 5
    }
  }
}
#Hall
Transform {
  translation -5 -82 75
  children Shape {
    appearance Appearance {
      material Material {
        diffuseColor 0 0.2 0
      }
    }
    geometry Cylinder { 
      radius 6
      height 5.1
    }
  }
}
ROUTE Golf.touchTime TO Timer.set_startTime
ROUTE Timer.fraction_changed TO MoveBall.set_fraction
ROUTE MoveBall.value_changed TO Ball.set_translation